import Icon from "./components/icon/icon.vue";
import Carousel from "./components/carousel/carousel.vue";
import CarouselItem from "./components/carousel/carousel-item.vue";
import Row from "./components/grid/grid.vue";
import Col from "./components/grid/col.vue";
import Radio from './components/radio/radio';
import RadioGroup from './components/radio/radio-group'
import Checkbox from './components/checkbox/checkbox';
import CheckboxGroup from './components/checkbox/checkbox-group'
import iSwitch from './components/switch/switch';
import Button from './components/button/button';
import ButtonGroup from './components/button/button-group';

const components = {
  Icon,
  Carousel,
  CarouselItem,
  Row,
  Col,
  Radio,
  RadioGroup,
  CheckboxGroup,
  Checkbox,
  iSwitch,
  Button,
  ButtonGroup
};

const install = function(Vue) {
  if (install.installed) {
    return;
  }
  Object.keys(components).forEach(key => {
    Vue.component(components[key].name, components[key]);
  });
};

// auto install by cdn
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue);
}

export {
  install,
  Icon,
  Carousel,
  CarouselItem,
  Row,
  Col,
  Radio,
  RadioGroup,
  CheckboxGroup,
  Checkbox,
  iSwitch,
  Button,
  ButtonGroup
};